package com.chixing.util;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @author 马博
 * * @date 2021/10/18
 * 该类提供了String 转换成json
 */
public class JsonUtil {
    private static ObjectMapper objectMapper=new ObjectMapper();
    public static JsonNode stringToJson(String src){
        try {
            return objectMapper.readTree(src);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
            return null;
        }
    }
}
